package priv.bestbeat.reportcenter.core.pdf.chart;

import org.jfree.chart.renderer.category.BarRenderer;

import java.awt.*;

/**
 * @author 张渠钦
 * @date 2022/4/7 10:47
 */
public class NewBarRenderer extends BarRenderer {

    private Paint[] colors;
    //初始化柱子颜色
    private String[] colorValues = { "#0044BB","#FF8800", "#77FF00", "#FF3333", "#FF88C2", "#FFFF33","#CCBBFF" };

    public NewBarRenderer() {
        colors = new Paint[colorValues.length];
        for (int i = 0; i < colorValues.length; i++) {
            colors[i] = Color.decode(colorValues[i]);
        }
    }

    @Override
    public Paint getItemPaint(int row, int column) {
        return colors[row % colors.length];
    }

    @Override
    public Paint getSeriesPaint(int series) {
        return colors[series % colors.length];
    }
}
